package logic

import (
	"context"

	"jinrigaoping/rpc/sys/internal/svc"
	"jinrigaoping/rpc/sys/sys"

	"github.com/zeromicro/go-zero/core/logx"
)

type SysUserUpdateStatusLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewSysUserUpdateStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SysUserUpdateStatusLogic {
	return &SysUserUpdateStatusLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *SysUserUpdateStatusLogic) SysUserUpdateStatus(in *sys.SysUserUpdateStatusReq) (*sys.SysUserUpdateStatusResp, error) {
	if err := l.svcCtx.SysUserModel.UpdateStatus(l.ctx, in.Id, in.Status); err != nil {
		logx.Errorf("SysUser UpdateStatus error:%v", err)
		return nil, err
	}

	return &sys.SysUserUpdateStatusResp{}, nil
}
